<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.js"></script>
    <script src="js/jquery.form.min.js"></script>
</head>
<body>
<!--图片高级上传-->
<form id="form1">
    图像:
    <input type="file" name="f" onchange="doUpload()" style="display:none">
    <br>
    <img id="img1" width="100px " src="http://127.0.0.1:8081/imgs/icon.JPEG" onclick="selectImg()">
    <br>
    <!--    <input type="submit">-->
</form>

</body>

<script>
    function doUpload() {
        //异步提交表单
        $('#form1').ajaxSubmit({
            url: '/file/fileUploadAdv',
            type: 'post',
            success: function (data) {
                //$("#img1").prop("src", data)//修改src属性
            }
        })
    }

    function selectImg() {
        $('input[name="f"]').click();
    }

</script>
</body>
</html>